#!/usr/bin/env python
#-*-encoding:utf-8-*-
'''
Created on 2015年10月20日

@author: chenyongbing
'''
import sys,os,time,urllib2,urllib,re,json
#current_dir = os.path.dirname(__file__)
current_dir = os.path.split(os.path.realpath(__file__))[0]

import inspect

#60.到访次数分布 - GroupList - 
#61.到访次数驻店时长分布 - GroupList - 

#48. 店铺概览：客流质量



#50. 趋势排行.png
#25. 连锁店概览：趋势分布图
#39. 顾客类型：关键指标
#40. 顾客类型：趋势指标
#41.   驻店时长：关键指标
# 43. 驻店时长：深访趋势 & 44. 驻店时长：跳出趋势

sys.path.append('../../')
from base.zhimind_datas import myZhimindDatas
from base.time_method import myTimeMethod

from verify_zhimind_ws_data import VerifyZhimindWSData



import logging
if __name__=='__main__':
    logging.basicConfig(level = logging.DEBUG)
    shop_group = 32012194
    city_group = 32010224
    prov_group = 32010223
    comp_group = 32010222
    groupType = 4
    if groupType == 4:
        groupList = [shop_group]
    elif groupType == 2:
        groupList = [city_group]
    elif groupType == 1:
        groupList = [prov_group]
    else:
        groupList = [comp_group]
    
    timeType = 1
    requestType = groupType
    xType = 1
    yType = 2
    dimension = timeType
    customerType = 0

    if timeType == 1:
        startTime = endTime ="2015-09-25"
    elif timeType == 2:
        startTime = '2015-09-21'
        endTime = '2015-09-27'
    elif timeType == 3:
        startTime = '2015-09-01'
        endTime ='2015-09-30'
    else:
        startTime = '2015-07-01'
        endTime = '2015-09-30'

    #base='http://222.92.13.226:18080/zm-ws-3.0/api/v3'
    base='http://60.191.203.30:8080/zm-ws-3.0/api/v3'
    myVerifyZhimindWSData = VerifyZhimindWSData(base=base,runType=2)
    
    groupTypes = [1,2,3,4]
    api_num = '2.39'
    if api_num == '2.39':

        startTime='2015-11-06'
        endTime = '2015-11-06'
        groupList=[32012422]
        myVerifyZhimindWSData.customer_data_keypoint(startTime, endTime, groupList, groupType)
    
    if api_num=='2.25':
        for xType in [1,2,3,4,6,8,9,11]:
            
            myVerifyZhimindWSData.data_cross_bubble(requestType=requestType, timeType=timeType, startTime=startTime, groupList=groupList, groupType=groupType, xType=xType, yType=yType)       
    if api_num == '2.40':
        for customerType in [3,10,11,12,13,14]:
            myVerifyZhimindWSData.customer_data_trend(startTime=startTime, endTime=endTime, groupList=groupList, groupType=groupType,dimension=dimension, customerType=customerType)
    if api_num == '2.41':
        for customerType  in [0,3,10]:
            myVerifyZhimindWSData.statis_duration_keypoint(startTime=startTime, endTime=endTime, groupList=groupList, groupType=groupType, customerType=customerType,timeType=timeType)
    if api_num =='2.48':
        myVerifyZhimindWSData.customer_quality(timeType, startTime, groupList,groupType)
    if api_num=='2.61':
        myVerifyZhimindWSData.stats_vf_duration_scatter_grouplist(startTime=startTime,endTime=endTime,customerType=customerType,groupList =groupList , groupType = groupType)
    if api_num=='2.10':
        myVerifyZhimindWSData.stats_visit_frequency_scatter(startTime, endTime, customerType, group=groupList[0], groupType=groupType)
    if api_num =='2.60':
        myVerifyZhimindWSData.stats_visit_frequency_scatter_grouplist(startTime, endTime, customerType, groupList, groupType)

    if api_num =='2.22':
        myVerifyZhimindWSData.stats_visit_frequency_scatter(startTime=startTime, endTime=endTime, customerType=0, group=groupList[0], groupType=groupType)

